<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>13-多级对象解构</title>
</head>
<body>
    <script>
        // 多级对象解构
        // 解构家庭成员
        // const cat = {
        //     name: '舒克',
        //     family:{
        //         mother:'猫妈妈',
        //         father:'猫爸爸',
        //         sister:'贝塔'
        //     },
        //     age: 1
        // }
        // const {name,family:{mother,father,sister},age} = cat
        // console.log(name)
        // console.log(mother)
        // console.log(father)
        // console.log(sister)
        // console.log(age)
        
        const cat = [
         {
            name: '舒克',
            family:{
                mother:'猫妈妈',
                father:'猫爸爸',
                sister:'贝塔'
            },
            age: 1
         }
        ]
        const [{name,family:{mother,father,sister},age}] = cat
        console.log(name)
        console.log(mother)
        console.log(father)
        console.log(sister)
        console.log(age)
    </script>
</body>
</html>